package cn.buk.tms.entity.misc;

import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;

/**
 * 导出模板中的字段导出信息
 * @author yfdai
 */
@Entity
@Table(name = "data_field_export_info")
public class DataFieldExportInfo {

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private int id;

  @Column(name = "enterprise_id")
  private int enterpriseId;

  @ManyToOne
  @JoinColumn(name = "data_template_id", foreignKey = @ForeignKey(name = "fk_data_export_template"))
  private DataFieldExportTemplate template;


  @ManyToOne
  @JoinColumn(name = "data_field_id", foreignKey = @ForeignKey(name = "fk_data_field_info"))
  private DataFieldInfo dataFieldInfo;

  /**
   * 空列的数据类型会变动的，所以此处要保留实际的数据类型
   */
  @Column(name = "data_type")
  private int dataType;

  /**
   * 数据字段的别名
   */
  @Column(length = 50)
  private String alias;


  /**
   * 导出时的列数
   */
  @Column(name = "column_index")
  private int columnIndex;


  @Column(name = "create_time", insertable = false, updatable = false)
  private Date createTime;



  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }


  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }


  public DataFieldInfo getDataFieldInfo() {
    return dataFieldInfo;
  }

  public void setDataFieldInfo(DataFieldInfo dataFieldInfo) {
    this.dataFieldInfo = dataFieldInfo;
  }

  public String getAlias() {
    return alias;
  }

  public void setAlias(String alias) {
    this.alias = alias;
  }

  public int getColumnIndex() {
    return columnIndex;
  }

  public void setColumnIndex(int columnIndex) {
    this.columnIndex = columnIndex;
  }

  public DataFieldExportTemplate getTemplate() {
    return template;
  }

  public void setTemplate(DataFieldExportTemplate template) {
    this.template = template;
  }

  public int getDataType() {
    return dataType;
  }

  public void setDataType(int dataType) {
    this.dataType = dataType;
  }

  public int getEnterpriseId() {
    return enterpriseId;
  }

  public void setEnterpriseId(int enterpriseId) {
    this.enterpriseId = enterpriseId;
  }
}
